package com.ldzy.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class ServletConfig extends AbstractAnnotationConfigDispatcherServletInitializer {
    //这个配置类相当于web.xml
    //加载spring配置类
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{SpringConfig.class};
    }
    //加载springMVC配置类
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{SpringMvcConfig.class};
    }
    //该方法的作用是,所有的请求都要经过前端控制器,由它派发给对应的控制器中方法
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }


}
